#include <sys/socket.h>
#include <cstring>
#include <cerrno>
#include <cstdio>
#include "ClientSocket.h"

using namespace yazi::socket;

ClientSocket::ClientSocket() : Socket() {}

ClientSocket::ClientSocket(const string& ip, const int port) : Socket(ip, port) {
    m_sockfd = ::socket(AF_INET, SOCK_STREAM, 0);
    if(m_sockfd == -1){
        perror("socket()");
        return;
    }
    connect(ip, port);
}

ClientSocket::~ClientSocket(){
    close();
}